import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * Description:改文件后缀名测试
 * User: rei
 * Date: 2025-11-27
 * Time: 21:12
 */
public class Test {
    public static void main(String[] args) {
        File file = new File("c:/temp/123.jpg");
        System.out.println(file.getName());
        String newName = file.getName();
        File newFileName = new File(newName.substring(0,newName.length() - 3) + "png");
        System.out.println(newFileName.getName());
        file.renameTo(newFileName);
        //System.out.println(file);
    }
}
